Skip to content

Parse addon gold/played-time into a DB table on upload#49

Merged
joefarrelly merged 1 commit into
devfrom
addon-data-db-table
Jun 30, 2026
Merged

Parse addon gold/played-time into a DB table on upload#49
joefarrelly merged 1 commit into
devfrom
addon-data-db-table

Conversation

@joefarrelly

Copy link
Copy Markdown
Owner

Summary

  • New ProfileAltAddonData model (alt OneToOne PK, gold, played_time_total, played_time_level) plus migration, matching the existing ProfileAltMythicPlus pattern.
  • ProfileUserView.perform_update now parses the uploaded .lua file once and upserts ProfileAltAddonData per matching alt, instead of ProfileUserView.list re-parsing the raw file on every cache miss with an indefinite cache (page=addon, no TTL). A failed parse logs a warning without failing the upload.
  • New altaddondata endpoint (ProfileAltAddonDataView), same IsSessionUser-style enforcement as altmythicplus. Removed the now-dead generic file-read branch and page=addon from ProfileUserView.list.

Test plan

  • Verified against the real stored upload in the dev environment (re-ran the parse against the existing file, confirmed ProfileAltAddonData populated with correct values)
  • pytest tests/ (38 passed)
  • ruff check
  • makemigrations / migrate applied cleanly

Replaces the page=addon read-through cache (which re-parsed the raw
.lua file on every cache miss, with no expiry) with parse-on-upload
into a new ProfileAltAddonData model, matching how every other
Profile* model is populated. Adds the altaddondata endpoint and drops
the now-dead generic file-read branch from ProfileUserView.list.
@joefarrelly joefarrelly enabled auto-merge (squash) June 30, 2026 23:10
@joefarrelly joefarrelly merged commit 4b48b5a into dev Jun 30, 2026
3 checks passed
@joefarrelly joefarrelly deleted the addon-data-db-table branch June 30, 2026 23:10
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apicore/views.py 92.59% 2 Missing ⚠️
apicore/models.py 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants